The present invention relates to an arithmetic circuit and an arithmetic apparatus and, particularly, to an arithmetic circuit and an arithmetic apparatus that perform parallel processing.
Generally, the color space is used as a means of representing color information of pixels that form an image. In the case of displaying images on a display or the like, the RGB System that represents Red-Green-Blue additive color mixing is widely used. On the other hand, in the case of selecting a foreground color for drawing illustrations or the like on a computer, the HSV System is often used for the reason that it offers familiarity with the sense of humans, being users. The HSV System represents color information using three elements of Hue, Saturation and Value.
To handle the color information represented in the RGB System (which is referred to hereinafter as RGB color space) and the color information represented in the HSV System (hereinafter as HSV color space), conversion between two systems is required. The conversion is performed by an image processor or the like. In a general instruction-set processor such as an image processor, 2-input 1-output instructions are often used. Further, to enhance the processing performance, a processor using VLIW (Very Long Instruction Word) architecture is also proposed.
In the case of conversion from the RGB color space to the HSV color space, Hue (H), Saturation (S) and Value (V) are represented as follows. Note that the minimum of Red (R), Green (G) and Blue (B) is 0, and the maximum is 1.
The formula for computation of Hue (H) differs depending on which of R, G and B is the maximum. First, when the value of R is the maximum among R, G and B, Hue (H) is represented by the following equation (1). MAX indicates the value of R, which is the maximum value. MIN indicates the minimum value among R, G and B, which is the smaller value of G and B.
      Equation    ⁢                  ⁢          (      1      )        ⁢          :                                    H          =                                    60              ×                                                G                  -                  B                                                  MAX                  -                  MIN                                                      +            0                                                (          1          )                    
When the value of G is the maximum among R, G and B, Hue (H) is represented by the following equation (2). MAX indicates the value of G, which is the maximum value. MIN indicates the minimum value among R, G and B, which is the smaller value of R and B.
      Equation    ⁢                  ⁢          (      2      )        ⁢          :                                    H          =                                    60              ×                                                B                  -                  R                                                  MAX                  -                  MIN                                                      +            120                                                (          2          )                    
When the value of B is the maximum among R, G and B, Hue (H) is represented by the following equation (3). MAX indicates the value of B, which is the maximum value. MIN indicates the minimum value among R, G and B, which is the smaller value of R and G.
      Equation    ⁢                  ⁢          (      3      )        ⁢          :                                    H          =                                    60              ×                                                R                  -                  G                                                  MAX                  -                  MIN                                                      +            240                                                (          3          )                    
Saturation (S) is represented by the following equation (4).
      Equation    ⁢                  ⁢          (      4      )        ⁢          :                                    S          =                                    MAX              -              MIN                        MAX                                                (          4          )                    
Value (V) is represented by the following equation (5).
Equation (5):V=MAX   (5)
As shown in the above equations (1) to (5), in the conversion from the RGB color space to the HSV color space, conditional branch to compare three values of R, G and B and operation to obtain the maximum value MAX and the minimum value MIN of R, G and B are required when calculating Hue (H). Further, it is also required to obtain a difference between two values other than the maximum value MAX (the numerator of the fraction in the first term of the right hand side of the equations (1) to (3)).
As an arithmetic processor to perform the conditional branch and calculate the maximum value and the minimum value, a VLIW processor is known, for example. Various other processors are also proposed.
For example, a technique of performing a process that involves conditional branch at high speed by executing parallel processing with a plurality of processor elements is proposed (Japanese Unexamined Patent Application Publication No. 2004-62401). This technique achieves a process involving conditional branch and calculation of the maximum value and the minimum value by selecting outputs of the processor elements using selectors.
Further, a technique of giving an instruction for a multi-functional unit (processor) to two or more issue slots in many instruction cycles in order to make good use of register file read ports is proposed (Japanese Unexamined Patent Application Publication (Translation of PCT Application) No. 2002-527812). This allows, even in the cycle where the multi-functional unit is not used, other functional units to use the issue slots, thereby achieving efficient use of the read ports.
Further, an architecture capable of handling the case where an address to be accessed varies depending on processing (i.e. conditional branch) (Japanese Unexamined Patent Application Publication No. 2010-97356) and a technique to efficiently and quickly detect a processor having the maximum value or the minimum value among compared data (Japanese Unexamined Patent Application Publication No. 2000-163384) are proposed.